package com.iotp.service.equipment;

import com.iotp.dao.equipment.EquipmentMapper;
import com.iotp.entity.equipment.Equipment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("equipmentService")
public class EquipmentServiceImpl implements EquipmentService {

    @Autowired
    private EquipmentMapper equipmentMapper;
    @Override
    public Long add(Equipment equipment) {
        this.equipmentMapper.insert(equipment);
        return equipment.getId();
    }

    @Override
    public void update(Equipment equipment) {
        this.equipmentMapper.updateByPrimaryKeySelective(equipment);
    }

    @Override
    public void delete(Long id) {
        this.equipmentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Equipment queryById(Long id) {
        return this.equipmentMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Equipment> queryByList(Equipment equipment) {
        return this.equipmentMapper.selectByCondition(equipment);
    }
}
